Produced by Araxis Merge on 2024-03-04 14:38:51 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | /Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme v4.0.7/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js/view | layer.js | 2023-11-17 03:37:16 +0000 |
| 2 | /Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme v4.0.8/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js/view | layer.js | 2024-01-30 04:28:54 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 9 | 1110 |
| Changed | 3 | 24 |
| Inserted | 3 | 18 |
| Removed | 2 | 2 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 1 | /** | 1 | /** | |||
| 2 | * Mageplaza | 2 | * Mageplaza | |||
| 3 | * | 3 | * | |||
| 4 | * NOTICE OF LICENSE | 4 | * NOTICE OF LICENSE | |||
| 5 | * | 5 | * | |||
| 6 | * This source file is subject to the Mageplaza.com license sliderConfig is | 6 | * This source file is subject to the Mageplaza.com license sliderConfig is | |||
| 7 | * available through the world-wide-web at this URL: | 7 | * available through the world-wide-web at this URL: | |||
| 8 | * https://www.mageplaza.com/LICENSE.txt | 8 | * https://www.mageplaza.com/LICENSE.txt | |||
| 9 | * | 9 | * | |||
| 10 | * DISCLAIMER | 10 | * DISCLAIMER | |||
| 11 | * | 11 | * | |||
| 12 | * Do not edit or add to this file if you wish to upgrade this extension to newer | 12 | * Do not edit or add to this file if you wish to upgrade this extension to newer | |||
| 13 | * version in the future. | 13 | * version in the future. | |||
| 14 | * | 14 | * | |||
| 15 | * @category Mageplaza | 15 | * @category Mageplaza | |||
| 16 | * @package Mageplaza_LayeredNavigation | 16 | * @package Mageplaza_LayeredNavigation | |||
| 17 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | 17 | * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | |||
| 18 | * @license https://www.mageplaza.com/LICENSE.txt | 18 | * @license https://www.mageplaza.com/LICENSE.txt | |||
| 19 | */ | 19 | */ | |||
| 20 | 20 | |||||
| 21 | define([ | 21 | define([ | |||
| 22 | 'jquery', | 22 | 'jquery', | |||
| 23 | 'Mageplaza_AjaxLayer/js/action/submit-filter', | 23 | 'Mageplaza_AjaxLayer/js/action/submit-filter', | |||
| 24 | 'Magento_Catalog/js/price-utils', | 24 | 'Magento_Catalog/js/price-utils', | |||
| 25 | 'accordion', | 25 | 'accordion', | |||
| 26 | 'productListToolbarForm', | 26 | 'productListToolbarForm', | |||
| 27 | 'jquery/jquery-ui' | 27 | 'jquery/jquery-ui' | |||
| 28 | ], function ($, submitFilterAction, ultil) { | 28 | ], function ($, submitFilterAction, ultil) { | |||
| 29 | "use strict"; | 29 | "use strict"; | |||
| 30 | var next_page = ""; | 30 | var next_page = ""; | |||
| 31 | var loading = false; | 31 | var loading = false; | |||
| 32 | var infinite_loaded_count = 0; | 32 | var infinite_loaded_count = 0; | |||
| 33 | var active = false; | 33 | var active = false; | |||
| 34 | 34 | |||||
| 35 | $.widget('mageplaza.layer', $.mage.accordion, { | 35 | $.widget('mageplaza.layer', $.mage.accordion, { | |||
| 36 | options: { | 36 | options: { | |||
| 37 | openedState: 'active', | 37 | openedState: 'active', | |||
| 38 | collapsible: true, | 38 | collapsible: true, | |||
| 39 | multipleCollapsible: true, | 39 | multipleCollapsible: true, | |||
| 40 | animate: 200, | 40 | animate: 200, | |||
| 41 | productsListSelector: '#layer-product-list', | 41 | productsListSelector: '#layer-product-list', | |||
| 42 | mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', | 42 | mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', | |||
| 43 | collapsibleElement: '[data-role=ln_collapsible]', | 43 | collapsibleElement: '[data-role=ln_collapsible]', | |||
| 44 | header: '[data-role=ln_title]', | 44 | header: '[data-role=ln_title]', | |||
| 45 | content: '[data-role=ln_content]', | 45 | content: '[data-role=ln_content]', | |||
| 46 | isCustomerLoggedIn: false, | 46 | isCustomerLoggedIn: false, | |||
| 47 | isAjax: true, | 47 | isAjax: true, | |||
| 48 | params: [], | 48 | params: [], | |||
| 49 | active: [], | 49 | active: [], | |||
| 50 | activeDesktop: [], | 50 | activeDesktop: [], | |||
| 51 | activeMobile: [], | 51 | activeMobile: [], | |||
| 52 | checkboxEl: 'input[type=checkbox], input[type=radio]', | 52 | checkboxEl: 'input[type=checkbox], input[type=radio]', | |||
| 53 | sliderElementPrefix: '#ln_slider_', | 53 | sliderElementPrefix: '#ln_slider_', | |||
| 54 | sliderTextElementPrefix: '#ln_slider_text_' | 54 | sliderTextElementPrefix: '#ln_slider_text_' | |||
| 55 | }, | 55 | }, | |||
| 56 | 56 | |||||
| 57 | _create: function () { | 57 | _create: function () { | |||
| 58 | this.initActiveItems(); | 58 | this.initActiveItems(); | |||
| 59 | 59 | |||||
| 60 | this._super(); | 60 | this._super(); | |||
| 61 | 61 | |||||
| 62 | this.initProductListUrl(); | 62 | this.initProductListUrl(); | |||
| 63 | this.initObserve(); | 63 | this.initObserve(); | |||
| 64 | this.initSlider(); | 64 | this.initSlider(); | |||
| 65 | this.initWishlistCompare(); | 65 | this.initWishlistCompare(); | |||
| 66 | this.selectedAttr(); | 66 | this.selectedAttr(); | |||
| 67 | this.renderCategoryTree(); | 67 | this.renderCategoryTree(); | |||
| 68 | }, | 68 | }, | |||
| 69 | 69 | |||||
| 70 | inFinite: function() { | 70 | inFinite: function() { | |||
| 71 | var self = this; | 71 | var self = this; | |||
| 72 | next_page = ""; | 72 | next_page = ""; | |||
| 73 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | 73 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | |||
| 74 | active = true; | 74 | active = true; | |||
| 75 | } | 75 | } | |||
| 76 | $(".pages-items li > a.next").each(function(){ | 76 | $(".pages-items li > a.next").each(function(){ | |||
| 77 | next_page = $(this).attr("href"); | 77 | next_page = $(this).attr("href"); | |||
| 78 | }); | 78 | }); | |||
| 79 | if(!next_page){ | 79 | if(!next_page){ | |||
| 80 | $('.infinite-loader').hide(); | 80 | $('.infinite-loader').hide(); | |||
| 81 | } | 81 | } | |||
| 82 | $(window).scroll(function(){ | 82 | $(window).scroll(function(){ | |||
| 83 | if(!loading && next_page && active && $(".infinite-loader").hasClass('scrolling') && $(window).scrollTop() >= $(".infinite-loader").offset().top-$(window).height()+100){ | 83 | if(!loading && next_page && active && $(".infinite-loader").hasClass('scrolling') && $(window).scrollTop() >= $(".infinite-loader").offset().top-$(window).height()+100){ | |||
| 84 | loading = true; | 84 | loading = true; | |||
| 85 | $(".pages-items li > a.next").each(function(){ | 85 | $(".pages-items li > a.next").each(function(){ | |||
| 86 | next_page = $(this).attr("href"); | 86 | next_page = $(this).attr("href"); | |||
| 87 | }); | 87 | }); | |||
| 88 | self.ajaxInfinite(next_page); | 88 | self.ajaxInfinite(next_page); | |||
| 89 | } | 89 | } | |||
| 90 | }); | 90 | }); | |||
| 91 | $(".infinite-loader .btn-load-more").click(function(){ | 91 | $(".infinite-loader .btn-load-more").click(function(){ | |||
| 92 | if(!loading && next_page){ | 92 | if(!loading && next_page){ | |||
| 93 | loading = true; | 93 | loading = true; | |||
| 94 | self.ajaxInfinite(next_page); | 94 | self.ajaxInfinite(next_page); | |||
| 95 | } | 95 | } | |||
| 96 | }); | 96 | }); | |||
| 97 | }, | 97 | }, | |||
| 98 | 98 | |||||
| 99 | ajaxInfinite: function (submitUrl) { | 99 | ajaxInfinite: function (submitUrl) { | |||
| 100 | var self = this; | 100 | var self = this; | |||
| 101 | infinite_loaded_count++; | 101 | infinite_loaded_count++; | |||
| 102 | $('.infinite-loader .btn-load-more').hide(); | 102 | $('.infinite-loader .btn-load-more').hide(); | |||
| 103 | $('.infinite-loader .loading').hide(); | 103 | $('.infinite-loader .loading').hide(); | |||
| 104 | $.ajax({ | 104 | $.ajax({ | |||
| 105 | url: submitUrl, | 105 | url: submitUrl, | |||
| 106 | type: 'get', | 106 | type: 'get', | |||
| 107 | beforeSend: function () { | 107 | beforeSend: function () { | |||
| 108 | $('.infinite-loader .btn-load-more').hide(); | 108 | $('.infinite-loader .btn-load-more').hide(); | |||
| 109 | $('.infinite-loader .loading').show(); | 109 | $('.infinite-loader .loading').show(); | |||
| 110 | }, | 110 | }, | |||
| 111 | success: function (res) { | 111 | success: function (res) { | |||
| 112 | loading = false; | 112 | loading = false; | |||
| 113 | var $products = $(res.products); | 113 | var $products = $(res.products); | |||
| 114 | if (res.backUrl) { | 114 | if (res.backUrl) { | |||
| 115 | window.location = res.backUrl; | 115 | window.location = res.backUrl; | |||
| 116 | return; | 116 | return; | |||
| 117 | } | 117 | } | |||
| 118 | if($products){ | 118 | if($products){ | |||
| 119 | $products.each(function(i,el){ | 119 | $products.each(function(i,el){ | |||
| 120 | if($(el).hasClass('products-grid')){ | 120 | if($(el).hasClass('products-grid')){ | |||
| 121 | var items_grid = $(this).find('.product-items .item'); | 121 | var items_grid = $(this).find('.product-items .item'); | |||
| 122 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | 122 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | |||
| 123 | $(self.options.productsListSelector).trigger('contentUpdated'); | 123 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 124 | } | 124 | } | |||
| 125 | if($(el).hasClass('products-list')){ | 125 | if($(el).hasClass('products-list')){ | |||
| 126 | var items_list = $(this).find('.product-items .item'); | 126 | var items_list = $(this).find('.product-items .item'); | |||
| 127 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | 127 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | |||
| 128 | $(self.options.productsListSelector).trigger('contentUpdated'); | 128 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 129 | } | 129 | } | |||
| 130 | if($(el).hasClass('toolbar-products')){ | 130 | if($(el).hasClass('toolbar-products')){ | |||
| 131 | if($(this).find('.pages a.next').length > 0){ | 131 | if($(this).find('.pages a.next').length > 0){ | |||
| 132 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); | 132 | $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); | |||
| 133 | }else{ | 133 | }else{ | |||
| 134 | $(self.options.productsListSelector + ' .pages a.next').remove(); | 134 | $(self.options.productsListSelector + ' .pages a.next').remove(); | |||
| 135 | } | 135 | } | |||
| 136 | } | 136 | } | |||
| 137 | }); | 137 | }); | |||
| 138 | if($("form[data-role=tocart-form]").length > 0 && !redirect_cart) { | 138 | if($("form[data-role=tocart-form]").length > 0 && !redirect_cart) { | |||
| 139 | $("form[data-role=tocart-form]").catalogAddToCart(); | 139 | $("form[data-role=tocart-form]").catalogAddToCart(); | |||
| 140 | } | 140 | } | |||
| 141 | window.setTimeout(function(){ | |||||
| 142 | $( '.product-item-info .effect-bhesfd' ).each( function() { | |||||
| 143 | var $item = $( this ), | |||||
| 144 | $detail = $item.find( '.product-item-details .product-item-inner' ), | |||||
| 145 | height = $item.height() + $detail.height() + 32; | |||||
| 146 | $item.find( '>.content-shadow' ).height( height ); | |||||
| 147 | $( window ).on( 'resize', function() { | |||||
| 148 | $detail = $item.find( '.product-item-details .product-item-inner' ); | |||||
| 149 | height = $item.height() + $detail.height() + 32; | |||||
| 150 | $item.find('>.content-shadow').height( height ); | |||||
| 151 | } ); | |||||
| 152 | }); | |||||
| 153 | }, 500); | |||||
| 141 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | 154 | $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); | |||
| 142 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | 155 | $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); | |||
| 143 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | 156 | $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); | |||
| 144 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | 157 | $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); | |||
| 145 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | 158 | $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); | |||
| 146 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | 159 | $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); | |||
| 147 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | 160 | $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); | |||
| 148 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | 161 | $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); | |||
| 149 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | 162 | $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); | |||
| 150 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | 163 | $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); | |||
| 151 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | 164 | $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); | |||
| 152 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | 165 | $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); | |||
| 153 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | 166 | $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); | |||
| 154 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | 167 | $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); | |||
| 155 | var hist = submitUrl; | 168 | var hist = submitUrl; | |||
| 156 | if(submitUrl.indexOf("p=") > -1){ | 169 | if(submitUrl.indexOf("p=") > -1){ | |||
| 157 | var len = submitUrl.length-submitUrl.indexOf("p="); | 170 | var len = submitUrl.length-submitUrl.indexOf("p="); | |||
| 158 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | 171 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | |||
| 159 | var page_param = ""; | 172 | var page_param = ""; | |||
| 160 | if(str_temp.indexOf("&") == -1){ | 173 | if(str_temp.indexOf("&") == -1){ | |||
| 161 | page_param = str_temp; | 174 | page_param = str_temp; | |||
| 162 | } else { | 175 | } else { | |||
| 163 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | 176 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | |||
| 164 | } | 177 | } | |||
| 165 | hist = submitUrl.replace(page_param, ""); | 178 | hist = submitUrl.replace(page_param, ""); | |||
| 166 | } | 179 | } | |||
| 167 | if (typeof window.history.pushState === 'function') { | 180 | if (typeof window.history.pushState === 'function') { | |||
| 168 | window.history.pushState({url: hist}, '', hist); | 181 | window.history.pushState({url: hist}, '', hist); | |||
| 169 | } | 182 | } | |||
| 170 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 183 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 171 | requirejs(['jquery', 'weltpixel_quickview' ], | 184 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 172 | function($, quickview) { | 185 | function($, quickview) { | |||
| 173 | $('.weltpixel-quickview').off('click').on('click', function() { | 186 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 174 | var prodUrl = $(this).attr('data-quickview-url'); | 187 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 175 | if (prodUrl.length) { | 188 | if (prodUrl.length) { | |||
| 176 | quickview.displayContent(prodUrl); | 189 | quickview.displayContent(prodUrl); | |||
| 177 | } | 190 | } | |||
| 178 | }); | 191 | }); | |||
| 179 | }); | 192 | }); | |||
| 180 | } | 193 | } | |||
| 181 | $(".products-grid .weltpixel-quickview").each(function(){ | 194 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 195 | $(this).parent().parent().addClass('has-quickview'); | |||||
| 196 | if($(this).parents('.product-type-advanced').find(".product-item-photo.porto-tb-featured-image .icon-absolute").length > 0){ | |||||
| 197 | $(this).appendTo($(this).parents('.product-type-advanced').find(".product-item-photo .porto-tb-featured-image .product-item-inner .product-item-actions")); | |||||
| 198 | }else{ | |||||
| 182 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | 199 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | |||
| 200 | } | |||||
| 183 | }); | 201 | }); | |||
| 184 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | 202 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||
| 185 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | 203 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||
| 186 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | 204 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { | |||
| 187 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 205 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 188 | }); | 206 | }); | |||
| 189 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | 207 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||
| 190 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 208 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 191 | }); | 209 | }); | |||
| 192 | } | 210 | } | |||
| 193 | self.initWishlistCompare(); | 211 | self.initWishlistCompare(); | |||
| 194 | next_page = ""; | 212 | next_page = ""; | |||
| 195 | $(".pages-items li > a.next").each(function(){ | 213 | $(".pages-items li > a.next").each(function(){ | |||
| 196 | next_page = $(this).attr("href"); | 214 | next_page = $(this).attr("href"); | |||
| 197 | }); | 215 | }); | |||
| 198 | $('.infinite-loader .loading').hide(); | 216 | $('.infinite-loader .loading').hide(); | |||
| 199 | if(next_page){ | 217 | if(next_page){ | |||
| 200 | $('.infinite-loader .btn-load-more').show(); | 218 | $('.infinite-loader .btn-load-more').show(); | |||
| 201 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | 219 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | |||
| 202 | if(!loading && next_page){ | 220 | if(!loading && next_page){ | |||
| 203 | loading = true; | 221 | loading = true; | |||
| 204 | self.ajaxInfinite(next_page); | 222 | self.ajaxInfinite(next_page); | |||
| 205 | } | 223 | } | |||
| 206 | }); | 224 | }); | |||
| 207 | } | 225 | } | |||
| 208 | } | 226 | } | |||
| 209 | 227 | |||||
| 210 | }, | 228 | }, | |||
| 211 | error: function () { | 229 | error: function () { | |||
| 212 | window.location.reload(); | 230 | window.location.reload(); | |||
| 213 | } | 231 | } | |||
| 214 | }); | 232 | }); | |||
| 215 | }, | 233 | }, | |||
| 216 | 234 | |||||
| 217 | initActiveItems: function () { | 235 | initActiveItems: function () { | |||
| 218 | var layerActivesDesktop = this.options.activeDesktop, | 236 | var layerActivesDesktop = this.options.activeDesktop, | |||
| 219 | layerActivesMobile = this.options.activeMobile, | 237 | layerActivesMobile = this.options.activeMobile, | |||
| 220 | activesDesktop = [], | 238 | activesDesktop = [], | |||
| 221 | activesMobile = []; | 239 | activesMobile = []; | |||
| 222 | if ($(".page-layout-1column").length){ | 240 | if ($(".page-layout-1column").length){ | |||
| 223 | this.options.multipleCollapsible = false; | 241 | this.options.multipleCollapsible = false; | |||
| 224 | } | 242 | } | |||
| 225 | 243 | |||||
| 226 | if (typeof window.layerActiveTabs !== 'undefined') { | 244 | if (typeof window.layerActiveTabs !== 'undefined') { | |||
| 227 | layerActivesDesktop, layerActivesMobile = window.layerActiveTabs; | 245 | layerActivesDesktop, layerActivesMobile = window.layerActiveTabs; | |||
| 228 | } | 246 | } | |||
| 229 | if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) | 247 | if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) | |||
| 230 | || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) { | 248 | || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) { | |||
| 231 | if (layerActivesMobile.length) { | 249 | if (layerActivesMobile.length) { | |||
| 232 | this.element.find('.filter-options-item').each(function (index) { | 250 | this.element.find('.filter-options-item').each(function (index) { | |||
| 233 | if (~$.inArray($(this).attr('attribute'), layerActivesMobile)) { | 251 | if (~$.inArray($(this).attr('attribute'), layerActivesMobile)) { | |||
| 234 | activesMobile.push(index); | 252 | activesMobile.push(index); | |||
| 235 | } | 253 | } | |||
| 236 | }); | 254 | }); | |||
| 237 | } | 255 | } | |||
| 238 | this.options.active = activesMobile; | 256 | this.options.active = activesMobile; | |||
| 239 | return this; | 257 | return this; | |||
| 240 | }else{ | 258 | }else{ | |||
| 241 | if (layerActivesDesktop.length) { | 259 | if (layerActivesDesktop.length) { | |||
| 242 | this.element.find('.filter-options-item').each(function (index) { | 260 | this.element.find('.filter-options-item').each(function (index) { | |||
| 243 | if (~$.inArray($(this).attr('attribute'), layerActivesDesktop)) { | 261 | if (~$.inArray($(this).attr('attribute'), layerActivesDesktop)) { | |||
| 244 | activesDesktop.push(index); | 262 | activesDesktop.push(index); | |||
| 245 | } | 263 | } | |||
| 246 | }); | 264 | }); | |||
| 247 | } | 265 | } | |||
| 248 | this.options.active = activesDesktop; | 266 | this.options.active = activesDesktop; | |||
| 249 | return this; | 267 | return this; | |||
| 250 | } | 268 | } | |||
| 251 | }, | 269 | }, | |||
| 252 | 270 | |||||
| 253 | initProductListUrl: function () { | 271 | initProductListUrl: function () { | |||
| 254 | var isProcessToolbar = false, | 272 | var isProcessToolbar = false, | |||
| 255 | isAjax = this.options.isAjax; | 273 | isAjax = this.options.isAjax; | |||
| 256 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | 274 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | |||
| 257 | if (isProcessToolbar) { | 275 | if (isProcessToolbar) { | |||
| 258 | return; | 276 | return; | |||
| 259 | } | 277 | } | |||
| 260 | if (isAjax) { | 278 | if (isAjax) { | |||
| 261 | isProcessToolbar = true; | 279 | isProcessToolbar = true; | |||
| 262 | } | 280 | } | |||
| 263 | 281 | |||||
| 264 | var urlPaths = this.options.url.split('?'), | 282 | var urlPaths = this.options.url.split('?'), | |||
| 265 | baseUrl = urlPaths[0], | 283 | baseUrl = urlPaths[0], | |||
| 266 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | 284 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | |||
| 267 | paramData = {}, | 285 | paramData = {}, | |||
| 268 | parameters; | 286 | parameters; | |||
| 269 | for (var i = 0; i < urlParams.length; i++) { | 287 | for (var i = 0; i < urlParams.length; i++) { | |||
| 270 | parameters = urlParams[i].split('='); | 288 | parameters = urlParams[i].split('='); | |||
| 271 | paramData[parameters[0]] = parameters[1] !== undefined | 289 | paramData[parameters[0]] = parameters[1] !== undefined | |||
| 272 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | 290 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | |||
| 273 | : ''; | 291 | : ''; | |||
| 274 | } | 292 | } | |||
| 275 | paramData[paramName] = paramValue; | 293 | paramData[paramName] = paramValue; | |||
| 276 | if (paramValue === defaultValue) { | 294 | if (paramValue === defaultValue) { | |||
| 277 | delete paramData[paramName]; | 295 | delete paramData[paramName]; | |||
| 278 | } | 296 | } | |||
| 279 | paramData = $.param(paramData); | 297 | paramData = $.param(paramData); | |||
| 280 | if (isAjax) { | 298 | if (isAjax) { | |||
| 281 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | 299 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | |||
| 282 | } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); | 300 | } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); | |||
| 283 | } | 301 | } | |||
| 284 | }, | 302 | }, | |||
| 285 | 303 | |||||
| 286 | initObserve: function () { | 304 | initObserve: function () { | |||
| 287 | var self = this; | 305 | var self = this; | |||
| 288 | var isAjax = this.options.isAjax; | 306 | var isAjax = this.options.isAjax; | |||
| 289 | ||||||
| 290 | // fix browser back, forward button | 307 | // fix browser back, forward button | |||
| 291 | if (typeof window.history.replaceState === "function") { | 308 | if (typeof window.history.replaceState === "function") { | |||
| 292 | window.history.replaceState({url: document.URL}, document.title); | 309 | window.history.replaceState({url: document.URL}, document.title); | |||
| 293 | 310 | |||||
| 294 | setTimeout(function () { | 311 | setTimeout(function () { | |||
| 295 | window.onpopstate = function (e) { | 312 | window.onpopstate = function (e) { | |||
| 296 | if (e.state) { | 313 | if (e.state) { | |||
| 297 | submitFilterAction(e.state.url, 1); | 314 | submitFilterAction(e.state.url, 1); | |||
| 298 | } | 315 | } | |||
| 299 | }; | 316 | }; | |||
| 300 | }, 0) | 317 | }, 0) | |||
| 301 | } | 318 | } | |||
| 302 | ||||||
| 303 | var pageElements = $('#layer-product-list').find('.pages a'); | 319 | var pageElements = $('#layer-product-list').find('.pages a'); | |||
| 304 | pageElements.each(function () { | 320 | pageElements.each(function () { | |||
| 305 | var el = $(this), | 321 | var el = $(this), | |||
| 306 | link = self.checkUrl(el.prop('href')); | 322 | link = self.checkUrl(el.prop('href')); | |||
| 307 | if (!link) { | 323 | if (!link) { | |||
| 308 | return; | 324 | return; | |||
| 309 | } | 325 | } | |||
| 310 | 326 | |||||
| 311 | el.bind('click', function (e) { | 327 | el.bind('click', function (e) { | |||
| 312 | e.stopPropagation(); | 328 | e.stopPropagation(); | |||
| 313 | e.preventDefault(); | 329 | e.preventDefault(); | |||
| 314 | if (isAjax) { | 330 | if (isAjax) { | |||
| 315 | submitFilterAction(link); | 331 | submitFilterAction(link); | |||
| 316 | } else location.href = link; | 332 | } else location.href = link; | |||
| 317 | }) | 333 | }) | |||
| 318 | }); | 334 | }); | |||
| 319 | 335 | |||||
| 320 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | 336 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | |||
| 321 | currentElements.each(function (index) { | 337 | currentElements.each(function (index) { | |||
| 322 | var el = $(this), | 338 | var el = $(this), | |||
| 323 | link = self.checkUrl(el.prop('href')); | 339 | link = self.checkUrl(el.prop('href')); | |||
| 324 | if (!link) { | 340 | if (!link) { | |||
| 325 | return; | 341 | return; | |||
| 326 | } | 342 | } | |||
| 327 | 343 | |||||
| 328 | el.bind('click', function (e) { | 344 | el.bind('click', function (e) { | |||
| 329 | e.stopPropagation(); | 345 | e.stopPropagation(); | |||
| 330 | e.preventDefault(); | 346 | e.preventDefault(); | |||
| 331 | if (isAjax) { | 347 | if (isAjax) { | |||
| 332 | submitFilterAction(link); | 348 | submitFilterAction(link); | |||
| 333 | } else { | 349 | } else { | |||
| 334 | location.href = link; | 350 | location.href = link; | |||
| 335 | } | 351 | } | |||
| 336 | }); | 352 | }); | |||
| 337 | }); | 353 | }); | |||
| 338 | 354 | |||||
| 339 | var optionElements = this.element.find('.filter-options a'); | 355 | var optionElements = this.element.find('.filter-options a'); | |||
| 340 | optionElements.each(function (index) { | 356 | optionElements.each(function (index) { | |||
| 341 | var el = $(this), | 357 | var el = $(this), | |||
| 342 | link = self.checkUrl(el.prop('href')); | 358 | link = self.checkUrl(el.prop('href')); | |||
| 343 | if (!link) { | 359 | if (!link) { | |||
| 344 | return; | 360 | return; | |||
| 345 | } | 361 | } | |||
| 346 | 362 | |||||
| 347 | el.bind('click', function (e) { | 363 | el.bind('click', function (e) { | |||
| 348 | if (el.hasClass('swatch-option-link-layered')) { | 364 | if (el.hasClass('swatch-option-link-layered')) { | |||
| 349 | self.selectSwatchOption(el); | 365 | self.selectSwatchOption(el); | |||
| 350 | } else { | 366 | } else { | |||
| 351 | var checkboxEl = el.siblings(self.options.checkboxEl); | 367 | var checkboxEl = el.siblings(self.options.checkboxEl); | |||
| 352 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | 368 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | |||
| 353 | } | 369 | } | |||
| 354 | 370 | |||||
| 355 | e.stopPropagation(); | 371 | e.stopPropagation(); | |||
| 356 | e.preventDefault(); | 372 | e.preventDefault(); | |||
| 357 | self.ajaxSubmit(link); | 373 | self.ajaxSubmit(link); | |||
| 358 | }); | 374 | }); | |||
| 359 | 375 | |||||
| 360 | var checkbox = el.siblings(self.options.checkboxEl); | 376 | var checkbox = el.siblings(self.options.checkboxEl); | |||
| 361 | checkbox.bind('click', function (e) { | 377 | checkbox.bind('click', function (e) { | |||
| 362 | e.stopPropagation(); | 378 | e.stopPropagation(); | |||
| 363 | self.ajaxSubmit(link); | 379 | self.ajaxSubmit(link); | |||
| 364 | }); | 380 | }); | |||
| 365 | }); | 381 | }); | |||
| 366 | 382 | |||||
| 367 | var swatchElements = this.element.find('.swatch-attribute'); | 383 | var swatchElements = this.element.find('.swatch-attribute'); | |||
| 368 | swatchElements.each(function (index) { | 384 | swatchElements.each(function (index) { | |||
| 369 | var el = $(this); | 385 | var el = $(this); | |||
| 370 | var attCode = el.attr('attribute-code'); | 386 | var attCode = el.attr('attribute-code'); | |||
| 371 | if (attCode) { | 387 | if (attCode) { | |||
| 372 | if (self.options.params.hasOwnProperty(attCode)) { | 388 | if (self.options.params.hasOwnProperty(attCode)) { | |||
| 373 | var attValues = self.options.params[attCode].split(","); | 389 | var attValues = self.options.params[attCode].split(","); | |||
| 374 | var swatchOptions = el.find('.swatch-option'); | 390 | var swatchOptions = el.find('.swatch-option'); | |||
| 375 | swatchOptions.each(function (option) { | 391 | swatchOptions.each(function (option) { | |||
| 376 | var elOption = $(this); | 392 | var elOption = $(this); | |||
| 377 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | 393 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | |||
| 378 | elOption.addClass('selected'); | 394 | elOption.addClass('selected'); | |||
| 379 | } | 395 | } | |||
| 380 | }); | 396 | }); | |||
| 381 | } | 397 | } | |||
| 382 | } | 398 | } | |||
| 383 | }); | 399 | }); | |||
| 384 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 400 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 385 | requirejs(['jquery', 'weltpixel_quickview' ], | 401 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 386 | function($, quickview) { | 402 | function($, quickview) { | |||
| 387 | $('.weltpixel-quickview').off('click').on('click', function() { | 403 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 388 | var prodUrl = $(this).attr('data-quickview-url'); | 404 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 389 | if (prodUrl.length) { | 405 | if (prodUrl.length) { | |||
| 390 | quickview.displayContent(prodUrl); | 406 | quickview.displayContent(prodUrl); | |||
| 391 | } | 407 | } | |||
| 392 | }); | 408 | }); | |||
| 393 | }); | 409 | }); | |||
| 394 | } | 410 | } | |||
| 395 | 411 | window.setTimeout(function(){ | ||||
| 412 | $( '.product-item-info .effect-bhesfd' ).each( function() { | |||||
| 413 | var $item = $( this ), | |||||
| 414 | $detail = $item.find( '.product-item-details .product-item-inner' ), | |||||
| 415 | height = $item.height() + $detail.height() + 32; | |||||
| 416 | $item.find( '>.content-shadow' ).height( height ); | |||||
| 417 | $( window ).on( 'resize', function() { | |||||
| 418 | $detail = $item.find( '.product-item-details .product-item-inner' ); | |||||
| 419 | height = $item.height() + $detail.height() + 32; | |||||
| 420 | $item.find('>.content-shadow').height( height ); | |||||
| 421 | } ); | |||||
| 422 | }); | |||||
| 423 | }, 500); | |||||
| 396 | $(".products-grid .weltpixel-quickview").each(function(){ | 424 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 397 | $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); | 425 | $(this).parent().parent().addClass('has-quickview'); | |||
| 426 | if($(this).parents('.product-type-advanced').find(".product-item-photo.porto-tb-featured-image .icon-absolute").length > 0){ | |||||
| 427 | $(this).appendTo($(this).parents('.product-type-advanced').find(".product-item-photo .porto-tb-featured-image .product-item-inner .product-item-actions")); | |||||
| 428 | }else{ | |||||
| 429 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | |||||
| 430 | } | |||||
| 398 | }); | 431 | }); | |||
| 399 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | 432 | $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); | |||
| 400 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | 433 | if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { | |||
| 401 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | 434 | $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { | |||
| 402 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 435 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 403 | }); | 436 | }); | |||
| 404 | } | 437 | } | |||
| 405 | if(isAjax) { | 438 | if(isAjax) { | |||
| 406 | self.inFinite(); | 439 | self.inFinite(); | |||
| 407 | }else{ | 440 | }else{ | |||
| 408 | $('.infinite-loader').hide(); | 441 | $('.infinite-loader').hide(); | |||
| 409 | } | 442 | } | |||
| 410 | }, | 443 | }, | |||
| 411 | 444 | |||||
| 412 | selectSwatchOption: function (el) { | 445 | selectSwatchOption: function (el) { | |||
| 413 | var childEl = el.find('.swatch-option'); | 446 | var childEl = el.find('.swatch-option'); | |||
| 414 | if (childEl.hasClass('selected')) { | 447 | if (childEl.hasClass('selected')) { | |||
| 415 | childEl.removeClass('selected'); | 448 | childEl.removeClass('selected'); | |||
| 416 | } else { | 449 | } else { | |||
| 417 | childEl.addClass('selected'); | 450 | childEl.addClass('selected'); | |||
| 418 | } | 451 | } | |||
| 419 | }, | 452 | }, | |||
| 420 | 453 | |||||
| 421 | initSlider: function () { | 454 | initSlider: function () { | |||
| 422 | var self = this, | 455 | var self = this, | |||
| 423 | slider = this.options.slider; | 456 | slider = this.options.slider; | |||
| 424 | 457 | |||||
| 425 | for (var code in slider) { | 458 | for (var code in slider) { | |||
| 426 | if (slider.hasOwnProperty(code)) { | 459 | if (slider.hasOwnProperty(code)) { | |||
| 427 | var sliderConfig = slider[code], | 460 | var sliderConfig = slider[code], | |||
| 428 | sliderElement = self.element.find(this.options.sliderElementPrefix + code), | 461 | sliderElement = self.element.find(this.options.sliderElementPrefix + code), | |||
| 429 | priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; | 462 | priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; | |||
| 430 | 463 | |||||
| 431 | if (sliderElement.length) { | 464 | if (sliderElement.length) { | |||
| 432 | sliderElement.slider({ | 465 | sliderElement.slider({ | |||
| 433 | range: true, | 466 | range: true, | |||
| 434 | min: sliderConfig.minValue, | 467 | min: sliderConfig.minValue, | |||
| 435 | max: sliderConfig.maxValue, | 468 | max: sliderConfig.maxValue, | |||
| 436 | step: 0.01, | 469 | step: 0.01, | |||
| 437 | values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], | 470 | values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], | |||
| 438 | slide: function (event, ui) { | 471 | slide: function (event, ui) { | |||
| 439 | self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); | 472 | self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); | |||
| 440 | }, | 473 | }, | |||
| 441 | change: function (event, ui) { | 474 | change: function (event, ui) { | |||
| 442 | self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); | 475 | self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); | |||
| 443 | } | 476 | } | |||
| 444 | }); | 477 | }); | |||
| 445 | } | 478 | } | |||
| 446 | self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); | 479 | self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); | |||
| 447 | } | 480 | } | |||
| 448 | } | 481 | } | |||
| 449 | }, | 482 | }, | |||
| 450 | 483 | |||||
| 451 | displaySliderText: function (code, from, to, format) { | 484 | displaySliderText: function (code, from, to, format) { | |||
| 452 | var textElement = this.element.find(this.options.sliderTextElementPrefix + code); | 485 | var textElement = this.element.find(this.options.sliderTextElementPrefix + code); | |||
| 453 | if (textElement.length) { | 486 | if (textElement.length) { | |||
| 454 | if (format !== null) { | 487 | if (format !== null) { | |||
| 455 | from = this.formatPrice(from, format); | 488 | from = this.formatPrice(from, format); | |||
| 456 | to = this.formatPrice(to, format); | 489 | to = this.formatPrice(to, format); | |||
| 457 | } | 490 | } | |||
| 458 | 491 | |||||
| 459 | textElement.html(from + ' - ' + to); | 492 | textElement.html(from + ' - ' + to); | |||
| 460 | } | 493 | } | |||
| 461 | }, | 494 | }, | |||
| 462 | 495 | |||||
| 463 | getSliderUrl: function (url, from, to) { | 496 | getSliderUrl: function (url, from, to) { | |||
| 464 | return url.replace('from-to', from + '-' + to); | 497 | return url.replace('from-to', from + '-' + to); | |||
| 465 | }, | 498 | }, | |||
| 466 | 499 | |||||
| 467 | formatPrice: function (value, format) { | 500 | formatPrice: function (value, format) { | |||
| 468 | return ultil.formatPrice(value, format); | 501 | return ultil.formatPrice(value, format); | |||
| 469 | }, | 502 | }, | |||
| 470 | 503 | |||||
| 471 | ajaxSubmit: function (submitUrl) { | 504 | ajaxSubmit: function (submitUrl) { | |||
| 472 | var isAjax = this.options.isAjax; | 505 | var isAjax = this.options.isAjax; | |||
| 473 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | 506 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | |||
| 474 | ||||||
| 475 | if (isAjax) { | 507 | if (isAjax) { | |||
| 476 | return submitFilterAction(submitUrl); | 508 | return submitFilterAction(submitUrl); | |||
| 477 | } | 509 | } | |||
| 478 | location.href = submitUrl; | 510 | location.href = submitUrl; | |||
| 479 | }, | 511 | }, | |||
| 480 | 512 | |||||
| 481 | checkUrl: function (url) { | 513 | checkUrl: function (url) { | |||
| 482 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | 514 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | |||
| 483 | 515 | |||||
| 484 | return regex.test(url) ? url : null; | 516 | return regex.test(url) ? url : null; | |||
| 485 | }, | 517 | }, | |||
| 486 | 518 | |||||
| 487 | //Handling 'add to wishlist' & 'add to compare' event | 519 | //Handling 'add to wishlist' & 'add to compare' event | |||
| 488 | initWishlistCompare: function () { | 520 | initWishlistCompare: function () { | |||
| 489 | var isAjax = this.options.isAjax; | 521 | var isAjax = this.options.isAjax; | |||
| 490 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | 522 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | |||
| 491 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | 523 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | |||
| 492 | $(elClass).each(function () { | 524 | $(elClass).each(function () { | |||
| 493 | var el = $(this); | 525 | var el = $(this); | |||
| 494 | if (isAjax){ | 526 | if (isAjax){ | |||
| 495 | $(el).bind('click', function (e) { | 527 | $(el).bind('click', function (e) { | |||
| 496 | var dataPost = $(el).data('post'), | 528 | var dataPost = $(el).data('post'), | |||
| 497 | formKey = $('input[name="form_key"]').val(), method = 'post'; | 529 | formKey = $('input[name="form_key"]').val(), method = 'post'; | |||
| 498 | if (formKey) { | 530 | if (formKey) { | |||
| 499 | dataPost.data.form_key = formKey; | 531 | dataPost.data.form_key = formKey; | |||
| 500 | } | 532 | } | |||
| 501 | 533 | |||||
| 502 | var paramData = $.param(dataPost.data), | 534 | var paramData = $.param(dataPost.data), | |||
| 503 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | 535 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | |||
| 504 | 536 | |||||
| 505 | e.stopPropagation(); | 537 | e.stopPropagation(); | |||
| 506 | e.preventDefault(); | 538 | e.preventDefault(); | |||
| 507 | 539 | |||||
| 508 | if (el.hasClass('towishlist')) { | 540 | if (el.hasClass('towishlist')) { | |||
| 509 | submitFilterAction(url, true, method); | 541 | submitFilterAction(url, true, method); | |||
| 510 | } else{ | 542 | } else{ | |||
| 511 | submitFilterAction(url, true, method); | 543 | submitFilterAction(url, true, method); | |||
| 512 | } | 544 | } | |||
| 513 | }); | 545 | }); | |||
| 514 | } | 546 | } | |||
| 515 | }) | 547 | }) | |||
| 516 | }, | 548 | }, | |||
| 517 | 549 | |||||
| 518 | //Selected attribute color after page load. | 550 | //Selected attribute color after page load. | |||
| 519 | selectedAttr: function () { | 551 | selectedAttr: function () { | |||
| 520 | var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); | 552 | var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); | |||
| 521 | 553 | |||||
| 522 | filterCurrent.each(function(){ | 554 | filterCurrent.each(function(){ | |||
| 523 | var el = $(this), | 555 | var el = $(this), | |||
| 524 | colorLabel = el.html(), | 556 | colorLabel = el.html(), | |||
| 525 | swatchAttr = $('.filter-options .filter-options-item .swatch-option-link-layered .swatch-option'); | 557 | swatchAttr = $('.filter-options .filter-options-item .swatch-option-link-layered .swatch-option'); | |||
| 526 | 558 | |||||
| 527 | swatchAttr.each(function(){ | 559 | swatchAttr.each(function(){ | |||
| 528 | var elA = $(this); | 560 | var elA = $(this); | |||
| 529 | if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ | 561 | if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ | |||
| 530 | elA.addClass('selected'); | 562 | elA.addClass('selected'); | |||
| 531 | } | 563 | } | |||
| 532 | }); | 564 | }); | |||
| 533 | }); | 565 | }); | |||
| 534 | }, | 566 | }, | |||
| 535 | 567 | |||||
| 536 | renderCategoryTree: function () { | 568 | renderCategoryTree: function () { | |||
| 537 | var iconExpand = this.element.find('.filter-options .icon-expand'); | 569 | var iconExpand = this.element.find('.filter-options .icon-expand'); | |||
| 538 | 570 | |||||
| 539 | iconExpand.each(function () { | 571 | iconExpand.each(function () { | |||
| 540 | var el = $(this); | 572 | var el = $(this); | |||
| 541 | 573 | |||||
| 542 | el.nextAll('ol').each(function() { | 574 | el.nextAll('ol').each(function() { | |||
| 543 | if($(this).find('input[checked]').length !== 0 | 575 | if($(this).find('input[checked]').length !== 0 | |||
| 544 | && !$(this).prevAll('.icon-expand').hasClass('active') | 576 | && !$(this).prevAll('.icon-expand').hasClass('active') | |||
| 545 | ) { | 577 | ) { | |||
| 546 | $(this).show(); | 578 | $(this).show(); | |||
| 547 | $(this).prevAll('.icon-expand').toggleClass('active'); | 579 | $(this).prevAll('.icon-expand').toggleClass('active'); | |||
| 548 | } | 580 | } | |||
| 549 | }); | 581 | }); | |||
| 550 | 582 | |||||
| 551 | el.bind('click', function (e) { | 583 | el.bind('click', function (e) { | |||
| 552 | el.nextAll('ol').toggle(); | 584 | el.nextAll('ol').toggle(); | |||
| 553 | el.toggleClass('active'); | 585 | el.toggleClass('active'); | |||
| 554 | e.stopPropagation(); | 586 | e.stopPropagation(); | |||
| 555 | }); | 587 | }); | |||
| 556 | }); | 588 | }); | |||
| 557 | } | 589 | } | |||
| 558 | }); | 590 | }); | |||
| 559 | 591 | |||||
| 560 | return $.mageplaza.layer; | 592 | return $.mageplaza.layer; | |||
| 561 | }); | 593 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.